<html>
<head><meta charset="utf-8"><title>tracy · t-compiler/wg-self-profile · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/index.html">t-compiler/wg-self-profile</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html">tracy</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200681456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681456">(Jun 12 2020 at 15:03)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> <span aria-label="scream" class="emoji emoji-1f631" role="img" title="scream">:scream:</span> </p>
<p><a href="/user_uploads/4715/lJ8Vyfj-qAJ3r55s060_YPIQ/image.png">image.png</a> </p>
<div class="message_inline_image"><a href="/user_uploads/4715/lJ8Vyfj-qAJ3r55s060_YPIQ/image.png" title="image.png"><img src="/user_uploads/4715/lJ8Vyfj-qAJ3r55s060_YPIQ/image.png"></a></div><p>I was playing around with <a href="https://github.com/wolfpld/tracy">tracy</a> recently,  it's surprisingly good :) so I hacked this on rustc (basically duplicating all the <code>session.time</code> and <code>profiler.generic_activity</code> calls with some macro hackery via <a href="https://github.com/gw3583/tracy-rs">this binding</a> used in Firefox's webrender). While it has a focus on profiling for video games (with frames and screenshots), it works for regular programs, and there are videos showing the new features for every release if you want to see what it's capable of. </p>
<p>I don't build rustc on windows, so this screenshot here was under WSL. On a real unix (or maybe WSL2) there'd be more information related to system threads, when they're waiting, or being migrated to another core and so on. </p>
<p>However, since the latest release, you can also get system call stack sampling (on windows, coming someday to linux), so here are some examples where I have memory profiling, source code and assembly, sampling etc <a href="https://usercontent.irccloud-cdn.com/file/OCzGkigp/image.png">here</a> and also <a href="https://usercontent.irccloud-cdn.com/file/a1lVKQHn/image.png">here</a> </p>
<div class="message_inline_image"><a href="https://usercontent.irccloud-cdn.com/file/OCzGkigp/image.png" title="here"><img src="https://usercontent.irccloud-cdn.com/file/OCzGkigp/image.png"></a></div><div class="message_inline_image"><a href="https://usercontent.irccloud-cdn.com/file/a1lVKQHn/image.png" title="here"><img src="https://usercontent.irccloud-cdn.com/file/a1lVKQHn/image.png"></a></div><p>In any case I just wanted to mention it in case you didn't already know about it :)</p>



<a name="200681547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681547">(Jun 12 2020 at 15:03)</a>:</h4>
<p>WHOA!</p>



<a name="200681609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681609">(Jun 12 2020 at 15:04)</a>:</h4>
<p>That's awesome! I've never heard of that before</p>



<a name="200681627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681627">(Jun 12 2020 at 15:04)</a>:</h4>
<p>I had the same reaction :)</p>



<a name="200681646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681646">(Jun 12 2020 at 15:04)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="120989">@Nicholas Nethercote</span></p>



<a name="200681647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681647">(Jun 12 2020 at 15:04)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="119009">@eddyb</span> ^^</p>



<a name="200681713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681713">(Jun 12 2020 at 15:05)</a>:</h4>
<p>I've personally never seen a FOSS profiler this good before, it looks like RAD's Telemetry</p>



<a name="200681779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681779">(Jun 12 2020 at 15:05)</a>:</h4>
<p>it has a couple features which are better than VTune regarding assembly and inlining</p>



<a name="200681968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200681968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200681968">(Jun 12 2020 at 15:07)</a>:</h4>
<p>anyway all the videos will explain all it can do better than I could, pretty exciting to me :)</p>



<a name="200682174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200682174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200682174">(Jun 12 2020 at 15:08)</a>:</h4>
<p>That's really cool! I'll have to watch those</p>



<a name="200682934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200682934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200682934">(Jun 12 2020 at 15:14)</a>:</h4>
<p>integration is less easy than for C++ but yeah, I just wanted to mention it, and we can talk about it later if it's interesting to the WG :)</p>



<a name="200707018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200707018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200707018">(Jun 12 2020 at 18:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> do you have a branch for your hack on rustc?</p>



<a name="200711525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200711525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200711525">(Jun 12 2020 at 19:05)</a>:</h4>
<p>no but I can try to push it as-is if you want</p>



<a name="200712354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200712354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200712354">(Jun 12 2020 at 19:13)</a>:</h4>
<p><span class="user-mention" data-user-id="125799">@andjo403</span> <a href="https://github.com/lqd/rust/tree/tracy_wip">https://github.com/lqd/rust/tree/tracy_wip</a> , you'll need to change <a href="https://github.com/lqd/rust/commit/69557357c042403855f45f72cd2d08f72a860d59#diff-6978bd9505d13315945faf1296af34c7R538">this hardcoded path</a> to your local build of the tracy library</p>



<a name="200712456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/200712456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#200712456">(Jun 12 2020 at 19:14)</a>:</h4>
<p>awesome thanks <span class="user-mention" data-user-id="116113">@lqd</span></p>



<a name="201513029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/201513029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#201513029">(Jun 21 2020 at 03:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> <a href="#narrow/stream/187831-t-compiler.2Fwg-self-profile/topic/tracy/near/200712354">said</a>:</p>
<blockquote>
<p>you'll need to change <a href="https://github.com/lqd/rust/commit/69557357c042403855f45f72cd2d08f72a860d59#diff-6978bd9505d13315945faf1296af34c7R538">this hardcoded path</a> to your local build of the tracy library</p>
</blockquote>
<p>I ended up making a different library that builds tracy client cpp by itself as part of my work to make a crate with a <code>tracing</code> layer for dumping data into Tracy. <a href="https://docs.rs/tracy-client-sys/0.7.0/tracy_client_sys/">https://docs.rs/tracy-client-sys/0.7.0/tracy_client_sys/</a> may be useful if you ever wanted to make it less of a hack.</p>



<a name="201513089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187831-t-compiler/wg-self-profile/topic/tracy/near/201513089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/187831-t-compiler/wg-self-profile/topic/tracy.html#201513089">(Jun 21 2020 at 03:04)</a>:</h4>
<p>That said, tracy does also have a converter from chrome profile files, so if very basic view into the application is sufficient, that route might be good too.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>